package ch1.base;

/**
 * 创建线程的两种方式
 */
public class NewThread {
    private static class UseThread extends Thread {
        @Override
        public void run() {
            System.out.println("继承Thread类开启线程");
        }
    }

    private static class UseRunable implements Runnable {

        @Override
        public void run() {
            System.out.println("实现Runnable接口开启线程");
        }
    }

    public static void main(String[] args) {
        UseThread useThread = new UseThread();
        useThread.start();

        UseRunable useRunable = new UseRunable();
        new Thread(useRunable).start();
    }
}